<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  <script type="text/javascript">
		$(function() {
			init();
		});
		function init(){
			var ip = $("#upIp").val();
			var serviceName = $("#upServiceName").val();
			$.ajax({
				cache:false,
				async:false,
				type:"POST",
				url: path+'cluster/showModel',
				data:{serviceName:serviceName,ip:ip},
				success: function(result){
					$("#modelContent").val(result.result[serviceName].template);
				}
			});
		}
		
		function updateModel(){
			var ip = $("#upIp").val();
			var serviceName = $("#upServiceName").val();
			var modelContent = $("#modelContent").val();
			$.ajax({
				cache:false,
				async:false,
				type:"POST",
				url: path+'cluster/updateModel',
				data:{serviceName:serviceName,ip:ip,modelContent:modelContent},
				success: function(result){
					if(result){
						alert("更新成功");
					}
				}
			});
		}
	</script>
<div class="box-body">
	<form role="form">
		<div class="form-group">
			<textarea id="modelContent" class="form-control" rows="15" placeholder="配置模板"></textarea>
        </div>
        <div class="box-footer">
           <a type="button" class="btn btn-info" onclick="updateModel()">更新</a>
           <input type="hidden" id="upIp" value="${ip }" />
           <input type="hidden" id="upServiceName" value="${serviceName }"/>
        </div>
       </form>
</div>
<input id="servId" type="hidden" value="2">


